<?php
/*
  $Id: veyton4.php 410 2009-11-02 18:02:07Z dis $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2001 - 2003 osCommerce

  Released under the GNU General Public License

************************************************************************

                    All rights reserved.

  iclear design pattern
  Copyright (C) 2007 - 2009 iclear GmbH

                    All rights reserved.

  This program is free software licensed under the GNU General Public License (GPL).

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  USA

*************************************************************************/
  if(!class_exists('IclearWrapperVeyton4')) {
  	require dirname(__FILE__) . '/veyton4.base.php';
  }

  define('IC_WRAPPER_ID', 'veyton4010e' );

  class IclearWrapper extends IclearWrapperVeyton4 {
    
// class constructor
    function IclearWrapper(&$icCore) {
      $this->icVersion = '$Id: veyton4.php 410 2009-11-02 18:02:07Z dis $';
    	global $icCore;
      parent::IclearWrapperVeyton4($icCore);
    }
    
    function storeOrder() {
      global $customer_status, $currency, $price, $language, $tax;
      $rc = false;
      
      if($basket =& $this->icCore->getBasket()) {
        global $SESS_LIFE;
        
        // $SESS_LIFE used in session modules / functions 2 determine session lifetime (time() + $SESS_LIFE)
        $SESS_LIFE = 1440;
        $icLang = $this->icCore->getLanguage();
        session_name(IC_SESSION_NAME);
        session_id($basket->sessionID());
        session_start();

        // recreate session data from basket 2 prevent logout after redirect iclear -> shopURL!
        $_SESSION = $basket->session();
        
        $customer_id = $basket->customerID();
        
        $language = new language($basket->language());
        $customers_status = new customers_status();
        $price = new price($customers_status->customers_status_id, $customers_status->customers_status_master);
        $tax = new tax();
        
        $xtOrder = new order();
        $xtResult = $xtOrder->_setOrder($basket->shopData('order'));
        $xtOrder->_sendOrderMail($xtResult['orders_id']);
        
        if($rc = $basket->orderID($xtResult['orders_id'])) {
        	if($basket->status() == IC_ORDER_WAIT) {
        	  $this->maskOrder();
        	}
        }
        $this->cleanSession();
      }
      return $rc;
    }
  }

?>
